Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://img10.360buyimg.com/n1/jfs/t1/246117/3/15332/54192/6694048cFa23f0d9b/67d0ed2d246c0261.jpg.avif',
      'https://img10.360buyimg.com/n1/jfs/t1/196667/35/32054/15783/63fdc0a6Fccbf7a89/2df39f784e5b933c.jpg.avif',
      'https://img10.360buyimg.com/n1/jfs/t1/139932/33/34665/18414/63fdc0a6Ff23f2ab2/f68e5909078addaa.jpg.avif',
      'https://img10.360buyimg.com/n1/jfs/t1/119795/14/36111/10157/63fdc0a6F1f7058df/fa4a087a29544886.jpg.avif',
      'https://img10.360buyimg.com/n1/jfs/t1/33691/37/19443/13652/63fdc0a6Fe1d850c3/f8b346bfa6d1bb4b.jpg.avif'
    ],


    // 商品详情介绍
    detailImg: [
      "https://img10.360buyimg.com/imgzone/jfs/t1/31183/19/20432/359293/63fdade3Ffea75665/bf099e7c41ee3461.jpg",
      "https://img10.360buyimg.com/imgzone/jfs/t1/31183/19/20432/359293/63fdade3Ffea75665/bf099e7c41ee3461.jpg",   
        "https://img10.360buyimg.com/imgzone/jfs/t1/31183/19/20432/359293/63fdade3Ffea75665/bf099e7c41ee3461.jpg"
    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})